const NewsModel = require("../../models/NewsModel")

const NewsService ={
    
    
    getList:async({_id})=>{//{}是查询所有记录，【】是要的字段
        return _id?NewsModel.find({_id,isPublish:1},[]): 
        NewsModel.find({isPublish:1},[]).sort({editTime:-1})
    }, 
    getTopList:async({limit})=>{//{}是查询所有记录，【】是要的字段
        return NewsModel.find({isPublish:1},[]).sort({editTime:-1}).limit(limit)
    }, 
    
}

module.exports =NewsService